home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Language/OS - Multiplatform Resource Library
/
LANGUAGE OS.iso
/
cpp_libs
/
awe2-0_1.lha
/
awe2-0.1
/
Src
/
RCS
/
Event.cc,v
< prev
next >
Wrap
Text File
|
1989-05-04
|
2KB
|
139 lines
head 3.2;
branch ;
access ;
symbols ;
locks grunwald:3.2; strict;
comment @@;
3.2
date 89.02.20.15.34.20; author grunwald; state Exp;
branches ;
next 3.1;
3.1
date 88.12.20.13.48.41; author grunwald; state Exp;
branches ;
next 1.2;
1.2
date 88.10.30.13.04.23; author grunwald; state Exp;
branches ;
next 1.1;
1.1
date 88.09.28.22.13.20; author grunwald; state Exp;
branches ;
next ;
desc
@@
3.2
log
@Start using Gnu library heaps for schedulers
@
text
@// This may look like C code, but it is really -*- C++ -*-
//
// Copyright (C) 1988 University of Illinois, Urbana, Illinois
//
// written by Dirk Grunwald (grunwald@@cs.uiuc.edu)
//
#include "Event.h"
#include "CpuMultiplexor.h"
#include "Thread.h"
Event::~Event()
{
lock.reserve();
assert( pPileOfThreads.isEmpty() );
lock.release();
}
void
Event::releaseAll()
{
while ( ! pPileOfThreads.isEmpty() ) {
Thread *p = (Thread *) (pPileOfThreads.remove());
if (debugFlag) {
cerr << "Release " << *p << "\n";
}
ThisCpu -> add(p);
}
}
void
Event::trigger()
{
lock.reserve();
generation++;
releaseAll();
lock.release();
}
void
Event::waitFor()
{
lock.reserve();
int gen = generation;
lock.release();
for (int i = 0; i < pLoops; i++) {
if (gen != generation) break;
}
if (gen == generation) {
ThisCpu -> reserveByException( this );
}
}
bool
Event::reserveByException(Thread *byWho)
{
lock.reserve();
pPileOfThreads.add( byWho );
lock.release();
return(TRUE);
}
void
Event::classPrintOn(ostream&)
{
}
@
3.1
log
@Steay version
@
text
@d63 5
@
1.2
log
@*** empty log message ***
@
text
@@
1.1
log
@Initial revision
@
text
@d1 6
d8 1
a8 1
#include "HardwareCpu.h"
d26 1
a26 1
ThisCpu -> add(p,0);
@